﻿using System;
using System.Collections.Generic;
using System.IO;
using Manager;
using UnityEngine;
using UnityEngine.Events;
using UnityEngine.UI;

namespace SceneAssist
{
	// Token: 0x0200051F RID: 1311
	public class Assist
	{
		// Token: 0x06001F42 RID: 8002 RVA: 0x00122C40 File Offset: 0x00120E40
	

		// Token: 0x06001F46 RID: 8006 RVA: 0x00122D18 File Offset: 0x00120F18
		public static bool FindFile(string _path, string _file, bool _sub = false)
		{
			if (!Directory.Exists(_path))
			{
				return false;
			}
			string[] files = Directory.GetFiles(_path, _file);
			if (files.Length > 0)
			{
				return true;
			}
			if (_sub)
			{
				string[] directories = Directory.GetDirectories(_path);
				for (int i = 0; i < directories.Length; i++)
				{
					if (Assist.FindFile(directories[i], _file, _sub))
					{
						return true;
					}
				}
			}
			return false;
		}

		// Token: 0x06001F47 RID: 8007 RVA: 0x00122D78 File Offset: 0x00120F78
		public static global::CharFemaleFile LoadFemaleFile(string _path, bool _noSetPNG = false)
		{
			global::CharFemaleFile charFemaleFile = null;
			return (!Assist.LoadFemaleFile(ref charFemaleFile, _path, _noSetPNG)) ? null : charFemaleFile;
		}

		// Token: 0x06001F48 RID: 8008 RVA: 0x00122D9C File Offset: 0x00120F9C
		public static bool LoadFemaleFile(ref global::CharFemaleFile _file, string _path, bool _noSetPNG = false)
		{
			if (_path.Length == 0)
			{
				return false;
			}
			if (_file == null)
			{
				_file = new global::CharFemaleFile();
			}
			_path = _file.ConvertCharaFilePath(_path, false);
			if (global::CharFile.CheckSBPRFile(_path))
			{
				global::Debug.LogWarning("対象外 : 要コンバート");
				return false;
			}
			if (global::CharFile.CheckHoneySelectCharaFile(_path) == 1 || global::CharFile.CheckHoneySelectCharaFile(_path) == 3)
			{
				_file.Load(_path, _noSetPNG, true);
				return true;
			}
			global::Debug.LogError("ありえない");
			return false;
		}

		// Token: 0x06001F49 RID: 8009 RVA: 0x00122E1C File Offset: 0x0012101C
		public static bool LoadFemaleCustomInfo(ref global::CharFemaleFile _file, string _path)
		{
			if (_file == null)
			{
				_file = new global::CharFemaleFile();
			}
			_path = _file.ConvertCharaFilePath(_path, false);
			if (!File.Exists(_path))
			{
				return false;
			}
			if (global::CharFile.CheckSBPRFile(_path))
			{
				global::Debug.LogWarning("対象外 : 要コンバート");
				return false;
			}
			if (global::CharFile.CheckHoneySelectCharaFile(_path) == 1 || global::CharFile.CheckHoneySelectCharaFile(_path) == 3)
			{
				return _file.LoadBlockData<global::CharFileInfoCustomFemale>(_file.femaleCustomInfo, _path);
			}
			global::Debug.LogError("ありえない");
			return false;
		}

		// Token: 0x06001F4A RID: 8010 RVA: 0x00122EA0 File Offset: 0x001210A0
		public static bool LoadFemaleCustomInfoAndParamerer(ref global::CharFemaleFile _file, string _path)
		{
			if (_file == null)
			{
				_file = new global::CharFemaleFile();
			}
			_path = _file.ConvertCharaFilePath(_path, false);
			if (!File.Exists(_path))
			{
				return false;
			}
			if (global::CharFile.CheckSBPRFile(_path))
			{
				global::Debug.LogWarning("対象外 : 要コンバート");
				return false;
			}
			if (global::CharFile.CheckHoneySelectCharaFile(_path) != 1 && global::CharFile.CheckHoneySelectCharaFile(_path) != 3)
			{
				global::Debug.LogError("ありえない");
				return false;
			}
			if (!_file.LoadBlockData<global::CharFileInfoCustomFemale>(_file.femaleCustomInfo, _path))
			{
				return false;
			}
			if (!_file.LoadBlockData<global::CharFileInfoParameterFemale>(_file.femaleParameterInfo, _path))
			{
				return false;
			}
			if (_file.femaleParameterInfo.InitParameter)
			{
				global::Singleton<Manager.Info>.Instance.InitState(_file.femaleParameterInfo, _file.femaleCustomInfo.personality, false, false);
				_file.SaveBlockData<global::CharFileInfoParameterFemale>(_file.femaleParameterInfo, _path);
			}
			return true;
		}

		// Token: 0x06001F4B RID: 8011 RVA: 0x00122F80 File Offset: 0x00121180
		public static bool LoadFemaleParamerer(ref global::CharFemaleFile _file, string _path)
		{
			if (_file == null)
			{
				_file = new global::CharFemaleFile();
			}
			_path = _file.ConvertCharaFilePath(_path, false);
			if (!File.Exists(_path))
			{
				return false;
			}
			if (global::CharFile.CheckSBPRFile(_path))
			{
				global::Debug.LogWarning("対象外 : 要コンバート");
				return false;
			}
			if (global::CharFile.CheckHoneySelectCharaFile(_path) == 1 || global::CharFile.CheckHoneySelectCharaFile(_path) == 3)
			{
				return _file.LoadBlockData<global::CharFileInfoParameterFemale>(_file.femaleParameterInfo, _path);
			}
			global::Debug.LogError("ありえない");
			return false;
		}

		// Token: 0x06001F4C RID: 8012 RVA: 0x00123004 File Offset: 0x00121204
		public static void LoadAnimation(global::CharFemale _female)
		{
			/*Manager.ADV.AnimeInfo animeInfo = null;
			if (!global::Singleton<Manager.ADV>.Instance.animeInfo.TryGetValue((!_female.femaleCustomInfo.isConcierge) ? _female.femaleCustomInfo.personality : 108, out animeInfo))
			{
				global::Debug.LogWarning(_female.femaleCustomInfo.personality);
				return;
			}
			_female.LoadAnimation(animeInfo.assetbundle, animeInfo.file);
			_female.loadAnimeIKCtrlList(animeInfo.assetbundle, "AnimeIKInfo_adv_" + animeInfo.file, true, true);*/
		}

		// Token: 0x06001F4D RID: 8013 RVA: 0x00123094 File Offset: 0x00121294
		public static bool CreateFeamale(ref global::CharFemale _female, string _file, int _no = 0, bool _force = false)
		{
			if (!_female.femaleFile.Load(_file, false, true))
			{
				if (_file == "ill_Sitri")
				{
					_female.LoadPresetInfo("ill_Sitri", false);
				}
				else if (!_force)
				{
					return false;
				}
			}
			if (_female.femaleParameterInfo.InitParameter)
			{
				global::Singleton<Manager.Info>.Instance.InitState(_female, false);
				_female.femaleFile.Save(_file);
			}
			_female.Load(false);
			ItemHolder component = _female.gameObject.GetComponent<ItemHolder>();
			if (component == null)
			{
				_female.gameObject.AddComponent<ItemHolder>();
			}
			Assist.LoadAnimation(_female);
			_female.setAnimatorParamFloat("height", _female.femaleCustom.GetShapeBodyValue(0));
			return true;
		}

		// Token: 0x06001F4E RID: 8014 RVA: 0x00123180 File Offset: 0x00121380
		public static global::CharFileInfoParameterFemale.State SetNowStateAnimation(global::CharFemale _female, ItemHolder _ih, bool _isChair = false)
		{
			if (_female == null)
			{
				return global::CharFileInfoParameterFemale.State.Blank;
			}
			global::CharFileInfoParameterFemale.State state = global::CharFileInfoParameterFemale.State.Blank;
			int num = 0;
			global::Singleton<Manager.Info>.Instance.GetStateAndStage(ref state, ref num, _female);
			string[][] array = new string[][]
			{
				new string[]
				{
					"Favor",
					"Lewdness",
					"Aversion",
					"Slavery",
					"Broken",
					"Normal"
				},
				new string[]
				{
					"Favor2",
					"Lewdness2",
					"Aversion2",
					"Slavery2",
					"Broken",
					"Normal"
				}
			};
			string name = (!_isChair) ? array[num][(int)state] : ((state != global::CharFileInfoParameterFemale.State.Broken) ? "Sit_Chair_00" : "Broken_Sit");
			if (_ih == null)
			{
				_ih = _female.gameObject.AddComponent<ItemHolder>();
			}
			_ih.PlayAnime(name, 0);
			Assist.SetNowAnimationLookAt(_female, name);
			return state;
		}

		// Token: 0x06001F4F RID: 8015 RVA: 0x00123278 File Offset: 0x00121478
		public static void SetNowAnimationLookAt(global::CharFemale _female, string _name)
		{
			if (_female == null)
			{
				return;
			}
            /*int key = (!_female.femaleCustomInfo.isConcierge) ? _female.femaleCustomInfo.personality : 108;
            Dictionary<string, Manager.ADV.AnimeLookAtInfo> dictionary;
            if (!global::Singleton<Manager.ADV>.Instance.animeLookAtInfo.TryGetValue(key, out dictionary))
            {
                return;
            }
            Manager.ADV.AnimeLookAtInfo animeLookAtInfo;
            if (!dictionary.TryGetValue(_name, out animeLookAtInfo))
            {
                return;
            }
            _female.ChangeLookEyesPtn(animeLookAtInfo.eyes);
            _female.ChangeLookNeckPtn(animeLookAtInfo.neck);*/
        }

		// Token: 0x06001F50 RID: 8016 RVA: 0x001232F4 File Offset: 0x001214F4
		public static void AddHelpScene(global::ImageHelpScene.HelpKind _kind)
		{
			global::ImageHelpScene.kind = _kind;
			global::ImageHelpScene.isAdd = true;
			//global::Singleton<Manager.Scene>.Instance.LoadReserv("ImageHelp", false, false, false, false, false);
		}

		// Token: 0x17000347 RID: 839
		// (get) Token: 0x06001F51 RID: 8017 RVA: 0x00123318 File Offset: 0x00121518
		public static string ConciergePath
		{
			get
			{
				return global::UserData.Path + "chara/female/ill_Sitri.png";
			}
		}

		// Token: 0x17000348 RID: 840
		// (get) Token: 0x06001F52 RID: 8018 RVA: 0x0012332C File Offset: 0x0012152C
		public static string ConciergeFile
		{
			get
			{
				return "ill_Sitri";
			}
		}

		// Token: 0x17000349 RID: 841
		// (get) Token: 0x06001F53 RID: 8019 RVA: 0x00123334 File Offset: 0x00121534
		public static string MalePath
		{
			get
			{
				return global::UserData.Path + "chara/male/ill_Player.png";
			}
		}

		// Token: 0x1700034A RID: 842
		// (get) Token: 0x06001F54 RID: 8020 RVA: 0x00123348 File Offset: 0x00121548
		public static string AssetBundleSystemSE
		{
			get
			{
				return "sound/data/systemse.unity3d";
			}
		}

		// Token: 0x06001F55 RID: 8021 RVA: 0x00123350 File Offset: 0x00121550
		public static string GetStateBGMFile(global::CharFileInfoParameterFemale.State _state)
		{
			string[] array = new string[]
			{
				"hs_bgm_10",
				"hs_bgm_02",
				"hs_bgm_11",
				"hs_bgm_04",
				"hs_bgm_05",
				"hs_bgm_01"
			};
			return array[(int)_state];
		}

		// Token: 0x02000520 RID: 1312
		[Serializable]
		public class ButtonInfo
		{
			// Token: 0x1700034B RID: 843
			// (get) Token: 0x06001F57 RID: 8023 RVA: 0x001233A0 File Offset: 0x001215A0
			// (set) Token: 0x06001F58 RID: 8024 RVA: 0x001233A8 File Offset: 0x001215A8
			public PointerEnterAction PEAction { get; set; }

			// Token: 0x06001F59 RID: 8025 RVA: 0x001233B4 File Offset: 0x001215B4
			public virtual void AddSelectSE()
			{
				if (this.PEAction == null && this.button)
				{
					this.PEAction = this.button.gameObject.AddComponent<PointerEnterAction>();
				}
				if (this.PEAction)
				{
					this.PEAction.listAction.Add(new UnityAction(this.PlaySelectSE));
				}
			}

			// Token: 0x06001F5A RID: 8026 RVA: 0x00123424 File Offset: 0x00121624
			public virtual void PlaySelectSE()
			{
				if (!this.button.interactable)
				{
					return;
				}
                //if (!global::Singleton<Manager.Sound>.Instance.IsPlay(Manager.Sound.Type.SystemSE, "sse_00_02"))
                //{
                //    global::Singleton<Manager.Sound>.Instance.Play(Manager.Sound.Type.SystemSE, Assist.AssetBundleSystemSE, "sse_00_01", 0f, true, -1, true, "abdata");
                //}
			}

			// Token: 0x040027B8 RID: 10168
			public Button button;
		}
	}
}
